/* indent size: 2 */

module.exports = app => {
  const DataTypes = app.Sequelize;

  const ProductClass = app.model.define('productclass', {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      autoIncrement: true,
      primaryKey: true
    },
    label: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    remarks: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: false
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: false
    }
  }, {
    tableName: 'productclass'
  });

  ProductClass.associate = function() {
    ProductClass.hasMany(app.model.Product, { foreignKey: 'pcId', targetKey: 'id' });
  }
  return ProductClass;
};
